<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper search-box-cuesList" style="margin-bottom:10px">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="12" :lg="20" :md="8" :sm="24">
            <a-form-item>
              <a-input placeholder="请输入登录名" v-model="queryParam.loginName"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden; margin-left:-40px" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search" title="搜索" shape="circle"></a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px" title="重置"
                        shape="circle"></a-button>
            </span>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <!-- 操作按钮区域 -->
<!--                <a-button type="primary" icon="download" @click="handleExportXls('用户信息')">导出</a-button>-->
                <a-dropdown v-if="selectedRowKeys.length > 0">
                  <a-menu slot="overlay">
                    <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
                  </a-menu>
                </a-dropdown>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>


    <!-- table区域-begin -->
    <div>

      <a-table
        ref="table"
        size="middle"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">

       	<span slot="headPhoto" slot-scope="text, record">
       		<div style="width: 40px;height: 40px;" v-if="record.headPhoto">
       			<img style="width: 100%; height: 100%;" :src="record.headPhoto"/>
       		</div>
       </span>

<!--        <span slot="action" slot-scope="text, record">-->
<!--       		<a v-if="record.isRemark == '0'" @click="shutdownRemark(record.userId,1)" title="禁止评论"><a-icon-->
<!--            type="exclamation-circle" style="color:#ed7770"/></a>-->
<!--       		<a v-else @click="shutdownRemark(record.userId,0)" title="允许评论"> <a-icon type="font-colors"-->
<!--                                                                                   style="color:#35ab5f"/></a>-->
<!--       </span>-->

      </a-table>
    </div>
    <!-- table区域-end -->

  </a-card>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import {getAction} from '@/api/manage'

  export default {
    name: "MemberList",
    mixins: [JeecgListMixin],
    data() {
      return {
        description: '用户信息管理页面',
        // 表头
        columns: [
          {
            title: '登录名',
            align: "center",
            dataIndex: 'loginName'
          },
          {
            title: '绑定手机号',
            align: "center",
            dataIndex: 'bindMobileNo'
          },
          {
            title: '昵称',
            align: "center",
            dataIndex: 'nickName'
          },
          {
            title: '用户头像',
            align: "center",
            dataIndex: 'headPhoto',
            scopedSlots: {customRender: 'headPhoto'},
          },
          {
            title: '真实姓名',
            align: "center",
            dataIndex: 'realName'
          },
          {
            title: '联系地址',
            align: "center",
            dataIndex: 'address'
          },
          {
            title: 'qq号',
            align: "center",
            dataIndex: 'qq'
          },
          {
            title: '性别',
            align: "center",
            dataIndex: 'sex'
          },
          {
            title: '证件类型',
            align: "center",
            dataIndex: 'cardType'
          },
          {
            title: '证件号码',
            align: "center",
            dataIndex: 'cardNo'
          },
          {
            title: '注册渠道',
            align: "center",
            dataIndex: 'regChannel'
          },
          // {
          //   title: '禁止评论',
          //   align: "center",
          //   dataIndex: 'isRemark',
          //   customRender:(t, r, i) => t==1?'禁止评论':'允许评论'
          // },
          // {
          //   title: '操作',
          //   align: "center",
          //   dataIndex: 'action',
          //   scopedSlots: {customRender: 'action'},
          // },
        ],
        url: {
          list: "/user/usrUserInfo/queryUserList",
          delete: "/user/usrUserInfo/delete",
          deleteBatch: "/user/usrUserInfo/deleteBatch",
          exportXlsUrl: "user/usrUserInfo/exportXls",
          importExcelUrl: "user/usrUserInfo/importExcel",
          shutdown: "/user/usrUserInfo/shutdownRemark"
        },
      }
    },
    computed: {
      importExcelUrl: function () {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      shutdownRemark(id, status) {
        var param = {
          userId: id,
          isRemark: status
        }
        getAction(this.url.shutdown, param).then((res) => {
          if (res.success) {
            this.loadData(1);
          }
          if (res.code === 510) {
            this.$message.warning(res.message)
          }

        })
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>